package org.example.est.service.impl;

import org.example.est.dao.EvaluateDao;
import org.example.est.dao.EvaluateDetailDao;
import org.example.est.dto.EvaluateDetailDTO;
import org.example.est.entity.EvaluateDetail;
import org.example.est.service.EvaluateDetailService;
import org.example.est.service.util.EstBeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EvaluateDetailServiceImpl implements EvaluateDetailService {
    @Autowired
    private EvaluateDetailDao evaluateDetailDao;

    @Override
    public int addBatchEvaluateDetail(List<EvaluateDetail> evaluateDetails) {
        return evaluateDetailDao.batchInsert(evaluateDetails);
    }

    @Override
    public List<EvaluateDetailDTO> listByEvaluateId(Long evaluateId) {
        List<EvaluateDetail> evaluateDetails =
                evaluateDetailDao.listByEvaluateId(evaluateId);
        return EstBeanUtil.convertTo(evaluateDetails, EvaluateDetailDTO.class);
    }
}
